package com.example.design.c.adapter;

/**
 * 对象适配者模式
 */
public class ObjectAdapterTest {
    public static void main(String[] args) {
        ITarget iTarget = new ObjectAdapter(new ObjectAdaptee());

        iTarget.newDeal(1);
    }
}

class ObjectAdapter implements ITarget{

    private ObjectAdaptee objectAdaptee;

    public ObjectAdapter(ObjectAdaptee objectAdaptee) {
        this.objectAdaptee = objectAdaptee;
    }

    @Override
    public void newDeal(int type) {
        objectAdaptee.specificRequest();
    }
}

//适配者类
class ObjectAdaptee{

    public void specificRequest(){
        System.out.println("适配者中的业务代码被调用");
    }
}